<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html ng-app="userApp">
<head>
<base href="<%=basePath%>">
<title>My JSP 'alarmList.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

<style type="text/css">
.controls.inline>* {
	display: inline-block;
}

.controls.inline>input {
	width: 100px;
}
</style>
</head>

<body>
	<div class="row-fluid" ng-controller="userApp">
		<!-- block -->
		<div class="block">
			<div class="navbar navbar-inner block-header">
				<div class="muted pull-left">添加网格</div>
			</div>
			<div class="block-content collapse in">
				<div class="span6">
					<form class="form-horizontal" method="post" id='addAlarmForm' action="addUser.do?menuId=4">
						<fieldset>
							<legend>添加用户</legend>
							<div class="control-group">
								<label class="control-label" for="focusedInput">账号:</label>
								<div class="controls">
									<input class="input-xlarge focused" id="focusedInput"
										type="text" name="name">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">类型:</label>
								<div class="controls">
									<input class="input-xlarge disabled" id="disabledInput"
										type="text" placeholder="" name="no">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">网格经度</label>
								<div class="controls">
									<input type="text" id="lngInput" name="lng" ng-model="lng">
								</div>
							</div>
							<div class="control-group warning">
								<label class="control-label" for="inputError">网格纬度</label>
								<div class="controls">
									<input type="text" id="latInput" name="lat" ng-model="lat">
								</div>
							</div>
							<div class="form-actions">
								<button type="submit" class="btn btn-primary">保存</button>
								<button type="reset" class="btn">重置</button>
							</div>
						</fieldset>
					</form>

				</div>
				<div class="span6">
					<legend>请在地图中选择坐标</legend>
					<div id="allmap" style="width:500px;height:500px;"></div>
				</div>
			</div>
		</div>
		<!-- /block -->
	</div>
	<script>
	var mapApp = angular.module("mapApp",[]);
	//var mapApp = angular.module("mapApp",[]);
	mapApp.controller("mapAppCtrl",function($scope){
	$(function(){
		//console.log(angular.element(document.getElementById("allmap")).scope());
		
			map.addEventListener("click",function(e){
			    //alert(e.point.lng + "," + e.point.lat);
			    var point = new BMap.Point( e.point.lng ,e.point.lat);
				map.addOverlay(new BMap.Marker(point));// 创建标注
		 		$scope.lng = e.point.lng;
		 		$scope.lat = e.point.lat;
		 		$("#lngInput").val($scope.lng);
		 		$("#latInput").val($scope.lat);
				//angular.element(document.getElementById("allmap")).scope()
				event.preventDefault();
				event.stopPropagation();
			});
		});
	});
	</script>
</body>
</html>
